/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t__find_driver_charset.c                           */
/*  NOTE      =                                                    */
/*  DATE      = 2016/03/18 by songbb                               */
/*******************************************************************/

#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"

#include "../../../../src/module/oracle/config.h"
#include "../../test_ora_comm.h"
#include <oracle/ora_core.h>
#include <oracle/comm/ora_comm.h>
#include <oracle/tns/ora_packet.h>
#include <frct_comm.h>

extern short __find_driver_charset(short s_param1
                                , short s_param2);

static int __suite_init(void)
{
    return 0;
}

static int __suite_cleanup(void)
{
    return 0;
}

/**
 * 正常测试
 */
static void __case1(void)
{
    CU_ASSERT_EQUAL(__find_driver_charset(1, 10000), 1);
}

/**
 * 正常测试
 */
static void __case2(void)
{
    CU_ASSERT_EQUAL(__find_driver_charset(2, 10000), 2);
}

/**
 * 正常测试
 */
static void __case3(void)
{
    CU_ASSERT_EQUAL(__find_driver_charset(31, 10000), 31);
}

/**
 * 正常测试
 */
static void __case4(void)
{
    CU_ASSERT_EQUAL(__find_driver_charset(178, 10000), 178);
}

/**
 * 正常测试
 */
static void __case5(void)
{
    CU_ASSERT_EQUAL(__find_driver_charset(873, 10000), 873);
}

/**
 * 正常测试
 */
static void __case6(void)
{
    CU_ASSERT_EQUAL(__find_driver_charset(0, 8029), 870);
}

/**
 * 正常测试
 */
static void __case7(void)
{
    CU_ASSERT_EQUAL(__find_driver_charset(0, 8030), 871);
}

int add_suite__find_driver_charset(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" __find_driver_charset()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    if (CU_add_test(pSuite, "case1", __case1) == NULL ||
        CU_add_test(pSuite, "case2", __case2) == NULL ||
        CU_add_test(pSuite, "case3", __case3) == NULL ||
        CU_add_test(pSuite, "case4", __case4) == NULL ||
        CU_add_test(pSuite, "case5", __case5) == NULL ||
        CU_add_test(pSuite, "case6", __case6) == NULL ||
        CU_add_test(pSuite, "case7", __case7) == NULL)
        return FR_FAIL;

    return FR_SUCC;
}
